widget: Move compuatation of what changed further up
authorBenjamin Otte <otte@redhat.com>
Sat, 9 Feb 2019 04:28:44 +0000 (05:28 +0100)
committerBenjamin Otte <otte@redhat.com>
Fri, 15 Feb 2019 05:53:17 +0000 (06:53 +0100)
This way, we can compare with literally the previous allocation and the
size will not be influenced by an adjusted allocation.

But more importantly, we can now use the transform/width/height values
for other stuff.

gtk/gtkwidget.c

index 39f50c3241942a02ade33da30404f5d2081abf6b..98505bbb5943573d9d584f57d25b8d28ac3dfc7d 100644 (file)
@@ -4141,6 +4141,12 @@ gtk_widget_size_allocate (GtkWidget           *widget,
 
   real_allocation = *allocation;
 
+  baseline_changed = priv->allocated_size_baseline != baseline;
+  size_changed = (priv->allocated_size.width != real_allocation.width ||
+                  priv->allocated_size.height != real_allocation.height);
+  position_changed = (priv->allocated_size.x != real_allocation.x ||
+                      priv->allocated_size.y != real_allocation.y);
+
   priv->allocated_size = *allocation;
   priv->allocated_size_baseline = baseline;
 
@@ -4229,12 +4235,6 @@ gtk_widget_size_allocate (GtkWidget           *widget,
       real_allocation.height = MAX (1, real_allocation.height);
     }
 
-  baseline_changed = priv->baseline != baseline;
-  size_changed = (priv->width != real_allocation.width ||
-                  priv->height != real_allocation.height);
-  position_changed = (priv->transform.x != real_allocation.x ||
-                      priv->transform.y != real_allocation.y);
-
   /* Set the widget allocation to real_allocation now, pass the smaller allocation to the vfunc */
   priv->transform.x = real_allocation.x;
   priv->transform.y = real_allocation.y;